package com.bookcloud.java21.chapter12.泛型类123;

public class PairExample {
  public static void main(String[] args) {
    // Pair实例使用类的演示
    Pair pair = new Pair("姓名", "张三");
    String key = (String) pair.getKey();
    String value = (String) pair.getValue();
    System.out.println("key:" + key + ",value:" + value);
    System.out.println("=================");
    // 实例化Pair对象pair2,age=12
    Pair pair2 = new Pair("年龄", 12);
    String ageKey = (String) pair2.getKey();
    int ageVal = (Integer) pair2.getValue();
    System.out.println("ageKey:" + ageKey + ",ageVal:" + ageVal);
  }
}
